#ifndef NETCOM_H
#define NETCOM_H

#include "packet.h"
#include "robot.h"
#include <netinet/in.h>
#include <inttypes.h>

#define READ_BUF_SIZE 2048
#define DATA_PATH "data.bin"

typedef struct conn_s {
	char address[32];
	uint16_t port;
	int sock;
	struct sockaddr_in sa;
	robot_data_t *data;
} conn_t;

status_t connection_new_robot(conn_t **conn, char *address, uint16_t port);
status_t connection_dispose(conn_t *conn);
status_t connection_send_stream(conn_t *conn, uint8_t *stream, uint16_t len);
status_t connection_recv_stream(conn_t *conn, uint8_t *stream, uint16_t *len);
status_t connection_get_data(conn_t *conn);

#endif
